<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="m" uri="/mytags" %>
<head>
    <title>海外院校列表</title>

    <script type="text/javascript">
        var oTable;
        require.config({
            paths: {
                "require-config": "/js/base/require.config"
            }
        });

        require(["require-config"], function () {
            require(["mytable"], function () {
                $(function () {
                    oTable = $("#dataTable").MyTable({
                        ajax: {
                            url: "${controllerUrlPrefix}/roleListData.do",
                            paramForm: "searchForm",
                            dataMaper: {
                                data: function (data) {

                                    data.data = data.content[0].records;
                                },
                                recordsTotal: function (data) {
                                    data.recordsTotal = data.content[0].totalRecords;
                                }
                            }
                        },
                        dataProcessBeforeRender: function (data) {


                        },
                        "columns": [
                            {"data": "name"},
                            {"data": "description"},
                            {"data": 'createTime'},
                            {"defaultContent": ''}

                        ],
                        addLinks: function (data) {
                            //增加每行末尾的操作功能,没有可以不加此方法
                            var tdStr = '<m:permissionA href="${controllerUrlPrefix}/editRoleUI.do?roleId='+data.id+'" module="role" moduleFunction="edit" title="编辑" />' +
                                    <%--' <m:permissionA href="${controllerUrlPrefix}/setUsersForRoleUI.do?roleId='+data.id+'" module="role" moduleFunction="setUsersForRole" title="分配角色" />' +--%>
                                    ' <m:permissionA href="${controllerUrlPrefix}/setPrivilegeUI.do?roleId='+data.id+'" module="role" moduleFunction="setPrivilege" title="调整权限" />';
                            return tdStr;
                        }
                    });
                    document.onkeydown = function (e) {
                        var ev = document.all ? window.event : e;
                        if (ev.keyCode == 13) {

                            oTable.ajax.reload();
                        }
                    };
                    $("#searchBtn").click(function () {
                        oTable.ajax.reload();
                    });
                });
            });
        });
        function msg() {
            if (confirm("确定要删除？") == false) {
                return false;
            }
        }
        function toDetail(pk) {
            window.open("<%=request.getContextPath() %>/abroad/front/abroadCollege_collegeDetail?abroadCollege.pk=" + pk);
        }
    </script>


</head>

<operationArea>

    <m:permissionA href="${controllerUrlPrefix}/addRoleUI.do" module="role" moduleFunction="add"
                   cssClass="btn btn-default" title="添加"/>
</operationArea>


<searchArea>

    <%--条件栏--%>
    <form id="searchForm" action="${controllerUrlPrefix}/search.do" method="post"
          onkeydown="if(event.keyCode==13){return false;}" class="form-inline">
        <div class="">
            <div class="form-group">
                <label>角色名称:</label>
                <input type="text" class="form-control" name="name"/>
            </div>

            <a class="search_button" id="searchBtn"></a>
        </div>
    </form>

</searchArea>

<tableArea>
    <table class="tDefault tablewidth tCenter dataTable mb10" id="dataTable">
        <thead>
        <tr>
            <th class="sorting" align="center" style="width: 100px">角色名称</th>
            <th class="sorting" style="width: 100px">描述</th>
            <th class="sorting" style="width: 90px">创建时间</th>
            <th class="sorting" style="width: 100px">操作</th>
        </tr>
        </thead>
        <tbody></tbody>
    </table>
</tableArea>

</html>
